package com.cr.front.service.impl;

import com.cr.front.dao.mapper.AuthenticationMapper;
import com.cr.front.pojo.dto.AuthenticationSaveParam;
import com.cr.front.pojo.entity.Authentication;
import com.cr.front.pojo.vo.LongRentVO;
import com.cr.front.service.AuthenticationService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class AuthenticationServiceImpl implements AuthenticationService {
    @Autowired
    private AuthenticationMapper authenticationMapper;
    @Override
    public void insert(AuthenticationSaveParam authenticationSaveParam) {
        Authentication authentication = new Authentication();
        BeanUtils.copyProperties(authenticationSaveParam,authentication);
        authentication.setStatus("认证中");
        authentication.setAuthenticationTime(new Date());
        authenticationMapper.insert(authentication);
    }

    @Override
    public List<LongRentVO> select() {
        List<LongRentVO> list = authenticationMapper.select();
        return list;
    }
}
